package com.share.shareplatform.util;



import com.share.shareplatform.pojo.GoodsOneComment;
import com.share.shareplatform.pojo.GoodsTwoComment;
import com.share.shareplatform.pojo.User;

import java.util.Collection;
import java.util.LinkedHashMap;

public class CollectionUtil {

    public  static LinkedHashMap<Long, GoodsOneComment> getLinkedHashMapByGoodsOneComment(Collection<GoodsOneComment> collection){
        LinkedHashMap<Long,GoodsOneComment> linkedHashMap=new LinkedHashMap<>();
        collection.forEach(value->{
            linkedHashMap.put(value.getId(), value);
        });
        return linkedHashMap;
    }

    public  static LinkedHashMap<Long, GoodsTwoComment> getLinkedHashMapByGoodsTwoComment(Collection<GoodsTwoComment> collection){
        LinkedHashMap<Long,GoodsTwoComment> linkedHashMap=new LinkedHashMap<>();
        collection.forEach(value->{
            linkedHashMap.put(value.getId(), value);
        });
        return linkedHashMap;
    }

    public  static LinkedHashMap<Long, User> getLinkedHashMapByUser(Collection<User> collection){
        LinkedHashMap<Long,User> linkedHashMap=new LinkedHashMap<>();
        collection.forEach(value->{
            linkedHashMap.put(value.getId(), value);
        });
        return linkedHashMap;
    }
}
